package org.dalmatian.common.translation.processor;

import org.dalmatian.common.core.utils.SolonUtils;
import org.dalmatian.common.translation.core.TranslationService;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.core.aspect.Interceptor;
import org.noear.solon.core.aspect.Invocation;

/**
 * @author zc
 */
@Slf4j
public class TranslationResponseInterceptor  implements Interceptor {

    @Override
    public Object doIntercept(Invocation inv) throws Throwable {
        TranslationService translationService = SolonUtils.getBean(TranslationService.class);
        Object result = inv.invoke();
        return new TranslationInvocationHandler(result, translationService).start();
    }
}
